import React, {useEffect} from "react";
import {Input, View} from "native-base";
import {StyleSheet} from "react-native";
import chinese from '../../capsulation/chinese';
export const SearchInput = ({ipt, setIpt, _searchPressingEnter}) => {
    //只能输入中文
    function change(val){
        if(chinese.isChn(val)){
            setIpt(val);
        }
    }
    return (
        // 搜索框
        <View style={styles.input}>
            <View style={styles.inputSearch}>
                <Input
                    value={ipt}
                    onChangeText={change}
                    onSubmitEditing={_searchPressingEnter}
                    autoFocus={true}
                    style={styles.inputSearch}
                    placeholder="搜索"
                    w="100%"
                />
            </View>
        </View>
    )
}

const styles = StyleSheet.create({
    input: {
        width: '100%',
        padding: 10,
        boxSizing: 'border-box',
        height: 60
    },
    inputSearch: {
        height: 40,
        borderColor: '#fff',
    },
})